//
//  PersonTableHeaderView.swift
//  XMYouPin
//
//  Created by 王宗成 on 2019/8/1.
//  Copyright © 2019 王宗成. All rights reserved.
//

import UIKit

class PersonTableHeaderView: UIView {

    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = .white
  
        imgView.frame = CGRect(x: 0, y: 0, width: kScreenW, height: kPersonHeaderImgViewHeight)
        imgView.snp.makeConstraints { (make) in
            
            make.left.right.equalToSuperview()
            make.top.equalToSuperview()
            make.height.equalTo(kPersonHeaderImgViewHeight)
        }
        
        folderView.snp.makeConstraints { (make) in
            
            make.bottom.left.right.equalToSuperview()
            make.height.equalTo(100)
        }
        
        self.addSubview(loginButton)
        self.loginButton.snp.makeConstraints { (make) in
            make.centerX.left.right.equalToSuperview()
            make.size.equalTo(CGSize(width: kScreenW, height: 55))
            make.centerY.equalTo(imgView.snp_centerY)
        }
        
        loginButton.imgView.image = IMAGE("mjyp_icon_default_head_portrait")
        loginButton.rightImgView.image = IMAGE("mjyp_icon_more_normal")
        loginButton.titleLabel.text = "请登录"
        loginButton.titleLabel.font = BFont(18)
        loginButton.titleLabel.textColor = .white
        
        loginButton.imgView.snp.remakeConstraints { (make) in
            
            make.left.equalTo(15)
            make.top.equalTo(0)
            make.size.equalTo(CGSize(width: 50, height: 50))
        }
        
        loginButton.rightImgView.snp.remakeConstraints { (make) in
            
            make.right.equalTo(-15)
            make.centerY.equalTo(loginButton.imgView.snp_centerY)
           
        }
        
        loginButton.titleLabel.snp.remakeConstraints { (make) in
            
            make.left.equalTo(loginButton.imgView.snp_right).offset(15)
            make.centerY.equalTo(loginButton.imgView.snp_centerY)
        }
    }
    
    let loginButton: WZCButton = {
        
        let button:WZCButton = WZCButton(frame: CGRect(x: 0, y: 0, width: 10, height: 10))
        
        return button
    }()
    
    public lazy var folderView:PersonPayFolderView = {
       
        let view:PersonPayFolderView = PersonPayFolderView(frame: CGRect(x: 0, y: 0, width: kScreenW, height: 1))
        addSubview(view)
        return view
    }()
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    public lazy var imgView : UIImageView = {
        let imageView = UIImageView()
        imageView.contentMode = UIView.ContentMode.scaleAspectFill
        imageView.image = IMAGE("mjyp_personal_bg_top")
        addSubview(imageView)
        return imageView
    }()

}
